﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using Eqwww.Domain.Models.SystemManage;
using Microsoft.AspNetCore.Authorization;

namespace Eqwww.Web
{
    [Authorize]
    public abstract class ControllerBase : Controller
    {
        
        protected virtual IActionResult Success(string message)
        {
            return new JsonResult(new { state = "success", message = message });
        }
        protected virtual IActionResult Success(string message, object data)
        {
            return new JsonResult(new { state = "success", message = message, data=data });
            
        }
        protected virtual IActionResult Error(string message)
        {
            return new JsonResult(new { state = "error", message = message});
            
        }

        protected virtual IActionResult NotFoundObject()
        {
            return View("~/Views/Manage/NotFoundObject.cshtml");
        }

        protected virtual IActionResult ErrorView(string message)
        {
            return View("~/Views/Manage/ErrorView.cshtml",message);
        }

        protected virtual IActionResult PermissionAccessDenied()
        {
            return View("~/Views/Manage/PermissionAccessDenied.cshtml");
        }

    }
}